// 引入router
import Vue from 'vue'
import Router from 'vue-router'

// 使用插件
Vue.use(Router)

/* 引入一级骨架组件 */
import Layout from '@/layout'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

// 路由的配置
export const constantRoutes = [{
  path: '/login',
  name: 'Login',
  component: () => import('@/views/login/index'),
  meta: { noAuth: true },
  hidden: true
},

{
  path: '/404',
  name: '404',
  component: () => import('@/views/404'),
  meta: { noAuth: true },
  hidden: true
},

{
  path: '/',
  component: Layout,
  redirect: '/dashboard',
  name: 'Dashboard',
  children: [{
    path: 'dashboard',
    name: 'Dashboard',
    component: () => import('@/views/dashboard/index'),
    meta: {
      title: '首页',
      icon: 'dashboard'
    }
  }]
},

{
  path: '/permissions',
  component: Layout,
  redirect: '/permissions/grouping',
  name: 'Grouping',
  meta: {
    title: '权限管理',
    icon: 'el-icon-lock'
  },
  children: [{
    path: 'grouping',
    name: 'Grouping',
    component: () => import('@/views/permissions/grouping/index'),
    meta: {
      title: '角色管理'
    }
  }, {
    path: 'menu',
    name: 'Menu',
    component: () => import('@/views/permissions/menu/index'),
    meta: {
      title: '菜单管理'
    }
  }]
},

{
  path: '/members',
  component: Layout,
  redirect: '/members',
  name: 'Members',
  children: [{
    path: 'members',
    name: 'Members',
    component: () => import('@/views/members/index'),
    meta: {
      title: '用户管理',
      icon: 'el-icon-s-custom'
    }
  }]
},

{
  path: '/audit',
  component: Layout,
  redirect: '/audit/dynamic',
  name: 'Dynamic',
  meta: {
    title: '审核管理',
    icon: 'el-icon-thumb'
  },
  children: [{
    path: 'dynamic',
    name: 'Dynamic',
    component: () => import('@/views/audit/dynamic/index'),
    meta: {
      title: '动态审核'
    }
  },
  {
    path: 'AllUserDetailProcessByTimeAsc',
    name: 'AllUserDetailProcessByTimeAsc',
    component: () => import('@/views/audit/AllUserDetailProcessByTimeAsc/index'),
    meta: {
      title: '用户信息审核'
    }
  },
  {
    path: 'FeedbackList',
    name: 'FeedbackList',
    component: () => import('@/views/audit/FeedbackList/index'),
    meta: {
      title: '用户反馈列表'
    }
  },
  {
    path: 'advertisementList',
    name: 'advertisementList',
    component: () => import('@/views/audit/advertisementList/index'),
    meta: {
      title: '广告审核列表'
    }
  },
  {
    path: 'dynamicExtension',
    name: 'dynamicExtension',
    component: () => import('@/views/audit/dynamicExtension/index'),
    meta: {
      title: '动态推广审核列表'
    }
  },
  {
    path: 'dynamicCustomer',
    name: 'dynamicCustomer',
    component: () => import('@/views/audit/dynamicCustomer/index'),
    meta: {
      title: '动态审核人员分单审核列表'
    }
  }
  ]
},
{
  path: '/auditThree',
  component: Layout,
  redirect: '/auditThree/auditIdentity',
  name: 'Dynamic',
  meta: {
    title: '三重认证',
    icon: 'el-icon-s-data'
  },
  children: [{
    path: 'auditIdentity',
    name: 'AuditIdentity',
    component: () => import('@/views/auditThree/auditIdentity/index'),
    meta: {
      title: '身份审核'
    }
  },
  {
    path: 'auditEducation',
    name: 'AuditEducation',
    component: () => import('@/views/auditThree/auditEducation/index'),
    meta: {
      title: '学历审核'
    }
  },
  {
    path: 'auditWork',
    name: 'AuditWork',
    component: () => import('@/views/auditThree/auditWork/index'),
    meta: {
      title: '工作审核'
    }
  }
  ]
},

{
  path: '/system',
  component: Layout,
  redirect: '/system/bannar',
  name: 'Bannar',
  meta: {
    title: '系统管理',
    icon: 'el-icon-setting'
  },
  children: [{
    path: 'bannar',
    name: 'Bannar',
    component: () => import('@/views/system/bannar/index'),
    meta: {
      title: '轮播图'
    }
  }, {
    path: 'charging',
    name: 'Charging',
    component: () => import('@/views/system/charging/index'),
    meta: {
      title: '计费规则'
    }
  }, {
    path: 'dynamic',
    name: 'Dynamic',
    component: () => import('@/views/system/dynamic/index'),
    meta: {
      title: '动态推广套餐'
    }
  }, {
    path: 'SuperVip',
    name: 'SuperVip',
    component: () => import('@/views/system/SuperVip/index.vue'),
    meta: {
      title: '配置充值会员的套餐表'
    }
  },
  {
    path: 'advertisement',
    name: 'Advertisement',
    component: () => import('@/views/system/advertisement/index.vue'),
    meta: {
      title: '广告套餐配置'
    }
  },
  {
    path: 'article',
    name: 'Article',
    component: () => import('@/views/system/article/index.vue'),
    meta: {
      title: '通知管理'
    }
  },
  {
    path: 'sensitiveWords',
    name: 'SensitiveWords',
    component: () => import('@/views/system/sensitiveWords/index.vue'),
    meta: {
      title: '敏感词管理'
    }
  },
  {
    path: 'TaskCenter',
    name: 'TaskCenter',
    component: () => import('@/views/system/TaskCenter/index.vue'),
    meta: {
      title: '任务管理'
    }
  }, {
    path: 'frontPageUrlConfiguration',
    name: 'frontPageUrlConfiguration',
    component: () => import('@/views/system/frontPageUrlConfiguration/index.vue'),
    meta: {
      title: '前端页面配置'
    }
  }, {
    path: 'rechargeMoney',
    name: 'RechargeMoney',
    component: () => import('@/views/system/rechargeMoney/index.vue'),
    meta: {
      title: '金币充值管理'
    }
  }, {
    path: 'appVersion',
    name: 'appVersion',
    component: () => import('@/views/system/appVersion/index.vue'),
    meta: {
      title: '遇识爱系统版本管理'
    }
  }, {
    path: 'appSetting',
    name: 'appSetting',
    component: () => import('@/views/system/appSetting/index.vue'),
    meta: {
      title: '遇识爱投资方式管理'
    }
  }
  ]
},

{
  path: '/question',
  component: Layout,
  redirect: '/question/questionList',
  name: 'questionList',
  meta: {
    title: '问题管理',
    icon: 'el-icon-question'
  },
  children: [{
    path: 'questionList',
    name: 'questionList',
    component: () => import('@/views/question/questionList/index'),
    meta: {
      title: '问题回答列表'
    }
  },
  {
    path: 'questionType',
    name: 'questionType',
    component: () => import('@/views/question/questionType/index'),
    meta: {
      title: '问题类型'
    }
  }
  ]
},

{
  path: '/present',
  component: Layout,
  redirect: '/present/present',
  name: 'Present',
  meta: {
    title: '礼物管理',
    icon: 'el-icon-present'
  },
  children: [{
    path: 'present',
    name: 'Present',
    component: () => import('@/views/present/present/index'),
    meta: {
      title: '礼物配置'
    }
  }, {
    path: 'presentlist',
    name: 'PresentList',
    component: () => import('@/views/present/presentlist/index'),
    meta: {
      title: '送礼列表'
    }
  }]
},

{
  path: '/report',
  component: Layout,
  redirect: '/report/report',
  name: 'Reporthome',
  meta: {
    title: '违规管理',
    icon: 'el-icon-warning'
  },
  children: [{
    path: 'report',
    name: 'Report',
    component: () => import('@/views/report/report/index'),
    meta: {
      title: '举报投诉'
    }
  }, {
    path: 'punishment',
    name: 'Punishment',
    component: () => import('@/views/report/punishment/index'),
    meta: {
      title: '处罚管理'
    }
  }, {
    path: 'reportlist',
    name: 'Reportlist',
    component: () => import('@/views/report/reportlist/index'),
    meta: {
      title: '处罚列表'
    }
  }]
},

{
  path: '/kefu',
  component: Layout,
  redirect: '/kefu/message',
  name: 'Kefu',
  meta: {
    title: '客服管理',
    icon: 'el-icon-present'
  },
  children: [{
    path: 'message',
    name: 'Message',
    component: () => import('@/views/kefu/message/index'),
    meta: {
      title: '客服'
    }
  },
  {
    path: 'setup',
    name: 'setup',
    component: () => import('@/views/kefu/setup/index'),
    meta: {
      title: '评价数据'
    }
  },

  ]
},
{
  path: '/kefuSetup',
  component: Layout,
  redirect: '/kefuSetup/evaluationSettings',
  name: 'EvaluationSettings1',
  meta: {
    title: '设置',
    icon: 'el-icon-set-up'
  },
  children: [
    {
      path: 'reply',
      name: 'reply',
      component: () => import('@/views/kefuSetup/reply/index'),
      meta: {
        title: '快捷回复'
      },
    },
    {
      path: 'evaluationSettings',
      name: 'EvaluationSettings1',
      component: () => import('@/views/kefuSetup/evaluationSettings/index'),
      meta: {
        title: '客服评价设置'
      },
    },
    // {
    //   path: 'problemsetting',
    //   name: 'Problemsetting1',
    //   component: () => import('@/views/kefuSetup/problemsetting/index'),
    //   meta: {
    //     title: '问题设置'
    //   },
    // }
  ]
},

{
  path: '/financial',
  component: Layout,
  redirect: '/financial/running',
  name: 'vipTable',
  meta: {
    title: '财务管理',
    icon: 'el-icon-printer'
  },
  children: [{
    path: 'running',
    name: 'Running',
    component: () => import('@/views/financial/running/index'),
    meta: {
      title: '充值提现明细'
    }
  },
  {
    path: 'goldCase',
    name: 'goldCase',
    component: () => import('@/views/financial/goldCase/index'),
    meta: {
      title: '固定表'
    }
  },
  {
    path: 'Distribution',
    name: 'Distribution',
    component: () => import('@/views/financial/Distribution/index.vue'),
    meta: {
      title: '邀请新用户'
    }
  },
  {
    path: 'vipTable',
    name: 'vipTable',
    component: () => import('@/views/financial/vip/index'),
    meta: {
      title: '会员核销明细'
    }
  },
  {
    path: 'goldCostTable',
    name: 'goldCostTable',
    component: () => import('@/views/financial/goldCostTable/index'),
    meta: {
      title: '金币核销明细'
    }
  },
  {
    path: 'dynamicExtensionTable',
    name: 'dynamicExtensionTable',
    component: () => import('@/views/financial/dynamicExtensionTable/index'),
    meta: {
      title: '作品加热明细'
    }
  },
  {
    path: 'advertisementRecordTable',
    name: 'advertisementRecordTable',
    component: () => import('@/views/financial/advertisementRecordTable/index'),
    meta: {
      title: '广告核销明细表'
    }
  },
  {
    path: 'userDistributionTable',
    name: 'userDistributionTable',
    component: () => import('@/views/financial/userDistributionTable/index'),
    meta: {
      title: '用户分销明细表'
    }
  },
  {
    path: 'userRewardTable',
    name: 'userRewardTable',
    component: () => import('@/views/financial/userRewardTable/index'),
    meta: {
      title: '用户收益明细表'
    }
  },
  {
    path: 'goldTable',
    name: 'goldTable',
    component: () => import('@/views/financial/gold/index'),
    meta: {
      title: '金币明细表'
    }
  },
  {
    path: 'summaryTable',
    name: 'summaryTable',
    component: () => import('@/views/financial/summary/index'),
    meta: {
      title: '财务汇总表'
    }
  }
  ]
},
{
  path: '/auditAdv',
  component: Layout,
  redirect: '/auditAdv/agentAudit',
  name: 'AgentAudit',
  meta: {
    title: '代理商管理',
    icon: 'el-icon-s-management'
  },
  children: [{
    path: 'agentAudit',
    name: 'AgentAudit',
    component: () => import('@/views/auditAdv/agentAudit/index'),
    meta: {
      title: '代理商列表'
    }
  },
  // {
  //   path: 'advertiserAudit',
  //   name: 'AdvertiserAudit',
  //   component: () => import('@/views/auditAdv/advertiserAudit/index'),
  //   meta: {
  //     title: '广告主审核'
  //   }
  // },
  {
    path: 'drawCommission',
    name: 'drawCommission',
    component: () => import('@/views/auditAdv/drawCommission/index'),
    meta: {
      title: '代理商设置'
    }
  },
  {
    path: 'toExamine',
    name: 'toExamine',
    component: () => import('@/views/advertiser/toExamine/index'),
    meta: {
      title: '资料审核'
    }
  },
  {
    path: 'agentAdvAudit',
    name: 'AgentAdvAudit',
    component: () => import('@/views/auditAdv/agentAdvAudit/index'),
    meta: {
      title: '广告审核'
    }
  },
  {
    path: 'withdrawalAudit',
    name: 'WithdrawalAudit',
    component: () => import('@/views/auditAdv/withdrawalAudit/index'),
    meta: {
      title: '提现审核'
    }
  },
  {
    path: 'userPenaltyList',
    name: 'UserPenaltyList',
    component: () => import('@/views/auditAdv/userPenaltyList/index'),
    meta: {
      title: '处罚列表'
    }
  },
  {
    path: 'feedbackAudit',
    name: 'FeedbackAudit',
    component: () => import('@/views/auditAdv/feedbackAudit/index'),
    meta: {
      title: '反馈列表'
    }
  },
  {
    path: 'joinAudit',
    name: 'JoinAudit',
    component: () => import('@/views/auditAdv/joinAudit/index'),
    meta: {
      title: '招商加盟'
    }
  }
  ]
},
{
  path: '/advertiser',
  component: Layout,
  redirect: '/advertiser/advertiserIndex',
  name: 'AdvertiserIndex',
  meta: {
    title: '代理商管理',
    icon: 'el-icon-s-data'
  },
  children: [{
    path: 'advertiserIndex',
    name: 'AdvertiserIndex',
    component: () => import('@/views/advertiser/advertiserIndex/index'),
    meta: {
      title: '首页'
    }
  },
  {
    path: 'advertisers',
    name: 'Advertisers',
    component: () => import('@/views/advertiser/advertisers/index'),
    meta: {
      title: '二级代理商'
    }
  },
  {
    path: 'advDesign',
    name: 'AdvDesign',
    component: () => import('@/views/advertiser/advDesign/index'),
    meta: {
      title: '广告设计投放'
    },
    children: [{
      path: "/adDetail/:type/:id",
      component: () => import('@/views/advertiser/adDetail'),
      meta: {
        title: "广告投放套餐",
      },
    }]
  },
  {
    path: 'advDetails',
    name: 'AdvDetails',
    component: () => import('@/views/advertiser/advDetails/index'),
    meta: {
      title: '广告投放'
    }
  },
  {
    path: 'advertiserInformation',
    name: 'AdvertiserInformation',
    component: () => import('@/views/advertiser/advertiserInformation/index'),
    meta: {
      title: '资料'
    }
  },
  {
    path: 'advEarnings',
    name: 'AdvEarnings',
    component: () => import('@/views/advertiser/advEarnings/index'),
    meta: {
      title: '我的收益'
    }
  },
  {
    path: 'subordinateAgents',
    name: 'SubordinateAgents',
    component: () => import('@/views/advertiser/subordinateAgents/index'),
    meta: {
      title: '下级代理商管理'
    }
  },
  {
    path: 'withdrawalAdvertiser',
    name: 'WithdrawalAdvertiser',
    component: () => import('@/views/advertiser/withdrawalAdvertiser/index'),
    meta: {
      title: '提现进度'
    }
  },
  {
    path: 'adDetail',
    name: 'AdDetail',
    component: () => import('@/views/advertiser/adDetail/index'),
    meta: {
      title: '广告投放套餐'
    }
  }
  ]
},
{
  path: '/auditShop',
  component: Layout,
  redirect: '/auditShop/shopkeeper',
  name: 'Shopkeeper',
  meta: {
    title: '商家管理',
    icon: 'el-icon-s-grid'
  },
  children: [
    {
      path: 'shopkeeper',
      name: 'Shopkeeper',
      component: () => import('@/views/auditShop/shopkeeper/index'),
      meta: {
        title: '商家资料审核'
      },

    },
    // {
    //   path: 'merchantcomplaints',
    //   name: 'Merchantcomplaints',
    //   component: () => import('@/views/auditShop/merchantcomplaints/index'),
    //   meta: {
    //     title: '商家投诉'
    //   },

    // },
    {
      path: 'productcomplaints',
      name: 'Productcomplaints',
      component: () => import('@/views/auditShop/productcomplaints/index'),
      meta: {
        title: '投诉管理'
      },

    },
    {
      path: 'shoplist',
      name: 'shoplist',
      component: () => import('@/views/auditShop/shoplist/index'),
      meta: {
        title: '商家列表'
      },
    }

    , {
      path: 'shopsort',
      name: 'Shopsort',
      component: () => import('@/views/auditShop/shopsort/index'),
      meta: {
        title: '商品分类'
      }
    }
    , {
      path: 'goods',
      name: 'shopGoods',
      component: () => import('@/views/auditShop/goods/index'),
      meta: {
        title: '商品审核'
      }
    }]
},

// {
//   path: '/qgsWeb',
//   component: Layout,
//   redirect: '/qgsWeb/news',
//   name: 'newsQGS',
//   meta: { title: '官网管理', icon: 'el-icon-s-grid' },
//   children: [{
//     path: 'news',
//     name: 'newsQGS',
//     component: () => import('@/views/qgsWeb/news/index'),
//     meta: { title: '新闻动态' }
//   },
//   {
//     path: 'memorabilia',
//     name: 'memorabiliaQGS',
//     component: () => import('@/views/qgsWeb/memorabilia/index'),
//     meta: { title: '大事记' }
//   },
//   {
//     path: 'product',
//     name: 'productQGS',
//     component: () => import('@/views/qgsWeb/product/index'),
//     meta: { title: '我们的产品' }
//   }]
// },

// 404 page must be placed at the end !!!
{
  path: '*',
  redirect: '/404',
  hidden: true
}
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
